feat: Add validate command - #307
Conversation
71d0bce to
4b6d6a4
Compare
amp validate checks an amp.yaml manifest without deploying it: schema and best-practice checks via amp-yaml-validator, backed by the live provider catalog and, when a project is configured, API-backed destination and provider-app checkers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4b6d6a4 to
4da9af0
Compare
laurenzlong
left a comment
There was a problem hiding this comment.
For all CLI PRs, please attach screenshot showing the command in action.
Attached |
connectors uses Git LFS; proxy.golang.org serves LFS pointer files, which fails go.sum verification against the real content hash. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Default setup can't set GOPRIVATE or install git-lfs, so its Go autobuild fails module verification. Same languages and schedule, Go built manually. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
I was actually thinking about the same command :) I’m testing Ampersand onboarding from scratch with an agent, and this would be really useful for validating One thing I noticed: if It would also be helpful to test the exit codes, since that’s what agents and CI will rely on. |
What
Adds
amp validate [ampYamlSourcePath]— validates anamp.yamlmanifest without deploying it.The path argument can be a directory containing
amp.yaml/amp.ymlor a path to the manifest file itself; it defaults to the current directory.Flags:
--strict— treat warnings as errors--skip-provider— skip provider-specific validation--skip-async— skip async error-prevention validationExits non-zero when validation fails, so it can gate CI. Output lists each error/warning with its rule, YAML path, line/column, and a suggestion when available.
How
Validation logic lives in the new
amp-labs/amp-yaml-validatorlibrary (shared so the same rules can run client-side and server-side). The CLI supplies it with live data through the library's dependency-injection hooks:validate/catalog.go— acatalog.CatalogProviderbacked by the live ("dynamic") provider catalog fetched from the public/v1/providersendpoint, so provider/module/capability checks stay current instead of relying on the catalog compiled into the connectors library. Fetched once per run and served from that snapshot.validate/checkers.go—DestinationChecker/ProviderAppCheckerverify that destinations and provider apps referenced by the manifest actually exist in the project, backed by one-time snapshots fromListDestinations/ListProviderApps.request/api.go— newFetchProviderCatalogfor the catalog endpoint (public, unauthenticated, not project-scoped; honorsAMP_API_URL).files/zip.go— newFindManifestFilehelper: explicit file paths are used as-is, directories are searched for the conventional manifest names.Graceful degradation
The command never requires network or a project to be useful:
--projectconfigured → destination and provider-app checks are skipped (the validator emits reminder warnings instead of hard errors).Dependencies
Adds
amp-labs/amp-yaml-validatorandamp-labs/connectors(plus their transitive tree — AWS SDK v2, OpenTelemetry, etc. — all indirect).Screenshots
Example of valid YAML:

Example of invalid YAML:

🤖 Generated with Claude Code